﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Reflection;
using System.Windows.Forms;

namespace DisplayBoardInfo.Server.Helpers
{
    public class Voice
    {
        private static string ivonaPath = Properties.Settings.Default.IVONAPath;
        private static bool voiceOn = Properties.Settings.Default.VoiceOn;

        public static void Read(string textToRead)
        {
            if (voiceOn)
            {
                try
                {
                    ProcessStartInfo psi = new ProcessStartInfo();
                    psi.FileName = ivonaPath;
                    psi.Arguments = "-q -c -p -t -nosplash";

                    Process process = new Process();
                    process.StartInfo = psi;

                    Clipboard.SetDataObject(textToRead);


                    process.Start();
                }
                catch (Exception)
                {
                    //Nie odczyta, życie :(
                }
            }
        }

        public static void RefreshSettings()
        { 
            ivonaPath = Properties.Settings.Default.IVONAPath;
            voiceOn = Properties.Settings.Default.VoiceOn;
        }
    }
}
